<?php
function getCon($serev_name, $user_name, $password, $db_name) {
  $con = mysqli_connect($serev_name, $user_name, $password, $db_name);
  if (!$con) {
    die("connection failed：". mysqli_connect_error());
  }
  return $con;
}
function query($con, $sql) {
  $res = [];
  $result = mysqli_query($con, $sql);
  if ($result && mysqli_num_rows($result) > 0) {
    while ($row = mysqli_fetch_assoc($result)) {
      $res[] = $row;
    }
  }
  return $res;
}